﻿using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Writer.API.Appliaction.Commends.Zyy.Usages;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Writer.API.Controllers.ZYY.Usages
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class USageController : ControllerBase
    {
        private readonly IMediator med;

        public USageController(IMediator med)
        {
            this.med = med;
        }
        /// <summary>
        /// 删除使用字段
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> DeleteUsageUasge(DeleteUsageCommand request, CancellationToken cancellationToken)
        {
            return await  med.Send (request, cancellationToken);   
        }
        /// <summary>
        /// 修改使用字段
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateUsageUasge(UpdateUsagecommand request, CancellationToken cancellationToken)
        {
            return await med.Send(request, cancellationToken);
        }
    }
}
